//
//  SMForgetPasswordTwoTableViewController.m
//  SaveMoney
//
//  Created by user on 2018/11/30.
//  Copyright © 2018年 Sunflower. All rights reserved.
//

#import "SMForgetPasswordTwoTableViewController.h"

@interface SMForgetPasswordTwoTableViewController ()
@property (weak, nonatomic) IBOutlet SBBaseTextField *onePasswordTF;
@property (weak, nonatomic) IBOutlet SBBaseTextField *twoPassTF;

@end

@implementation SMForgetPasswordTwoTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"修改密码";
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 1 || indexPath.row == 3) {
        return SBScaleNumber(50);
    } else if (indexPath.row == 0) {
        return SBScaleNumber(40);
    } else {
        return SBScaleNumber(20);
    }
    
}
- (IBAction)buttonAction:(id)sender {
    if (![_onePasswordTF.text isValid]) {
        [SVProgressHUD showErrorWithStatus:@"密码为空"];
        return;
    }
    if (![_twoPassTF.text isValid]) {
        [SVProgressHUD showErrorWithStatus:@"密码为空"];
        return;
    }
    [SVProgressHUD show];
    [[NetworkAction sharedAction] isHaveUserWithPhone:_phone password:_twoPassTF.text userid:_userId success:^(id model, NSString *message) {
        [SVProgressHUD showSuccessWithStatus:@"修改成功"];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [self.navigationController popToRootViewControllerAnimated:YES];
        });
        
    } failuer:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:[error localizedDescription]];
    }];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
